<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title>给我狠狠登录</title>
		<link href="favicon.ico" rel="shortcut icon" />
		<link rel="icon" href="http://www.zlhpro.online:8080/pictures/bilibilibog.ico">
		<link rel="canonical" href="https://getbootstrap.com/docs/3.4/examples/carousel/">
		<link href="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.20/dist/css/bootstrap.min.css"
			rel="stylesheet">
		<script src="js/jquery-3.4.1.min.js"></script>
		<link href="https://cdn.bootcss.com/twitter-bootstrap/3.4.0/css/bootstrap.min.css" rel="stylesheet">

		<style>
			#nbtn {
				position: absolute;
				right: 76px;
				top: 26px;
				width: 257px;
				height: 56px;
				border-radius: 7px;
				background-color: rgba(40, 124, 221, 86);
				color: rgba(255, 255, 255, 86);
				font-size: 28px;
				text-align: center;
				font-family: Microsoft Yahei;
				border: 1px solid rgba(187, 187, 187, 100);
			}
		</style>
		<script>
			$(document).ready(function() {

				//定义节流,时间戳实现
				function throttle(fn, delay) {
					let run = true,
						timer;
					return function() {
						if (!run) {
							//点击过快提示
							alert("点的太快了，歇会儿吧");
							return;
						}
						run = false;
						fn.apply(this, arguments);
						timer = setTimeout(() => {
							run = true;
							clearTimeout(timer);
						}, delay);
					};
				}

				//登录函数
				function thlog() {
					console.log("woshigeshabi");
					console.log($("#sid").val());
					console.log($("#spwd").val());
					$.ajax({
						url: 'http://www.zlhpro.online:8080/bilibili/User/Login',
						type: 'POST',
						// dataType: 'jsonp',
						// processData: false,
						// async: true, 
						data: {
							UserPhone: $("#sid").val(),
							UserPwd: $("#spwd").val()
						},
						success: function() {
							window.location.href = "index.html";
						},
						error: function() {
							var us = $("#sid").val();
							console.log(us);
							// console.log(data);
							alert("宝，账号或者密码错误了");
						}
					})

				}

				// 登录使用节流
				$(".login").click(throttle(thlog, 2000));

				// 注册
				$(".register").click(function() {
					alert("禁止注册叔叔的网站！！");
				});


			});
		</script>

	</head>
	<body style=" background: url(http://www.zlhpro.online:8080/pictures/laopo.jpg) no-repeat center center fixed; background-size: 100%;">

		<div class="modal-dialog" style="margin-top: 10%;">
			<div class="modal-content">
				<div class="modal-header">

					<h4 class="modal-title text-center" id="myModalLabel">登录</h4>
				</div>
				<div class="modal-body" id="model-body">
					<div class="form-group">

						<input type="text" class="form-control" id="sid" placeholder="用户名" autocomplete="off">
					</div>
					<div class="form-group">

						<input type="password" class="form-control" id="spwd" placeholder="密码" autocomplete="off">
					</div>
				</div>
				<div class="modal-footer">
					<div class="form-group">
						<button type="button" class="btn btn-primary form-control login">登录</button>
					</div>
					<div class="form-group">
						<button type="button" class="btn btn-default form-control register">注册</button>
					</div>

				</div>
			</div>
		</div>

	</body>
</html>
